# coding=utf-8
# article_details.py
"""
manage url
:author: antony zhao
:date: 24/03/2020
"""


# the class for managing url
from dao.dao_csdn_articles import DaoCsdnArticles


class ArticleDetails(object):

    def __init__(self):
        self.id = ""
        self.title = ""
        self.article_des = ""
        self.date = ""
        self.page_view = ""
        self.comments_count = ""
        self.href = ""
        self.article_body = ""

    def get_article_info_from_mysql(self):
        pass

    def save_article_info_to_mysql(self):
        """
        save article info to database
        :return: is it successful? True or False
        """
        dao_csdn_articles = DaoCsdnArticles()
        article_info = {"id": self.id, "title": self.title, "article_des": self.article_des, "date": self.date,
                        "page_view": self.page_view, "comments_count": self.comments_count, "href": self.href,
                        "article_body": self.article_body}
        dao_csdn_articles.set_article_info(article_info)

        return True
